<template>
	<div class="zhu">
		<div class="line"></div>
		<div class="form">
			<div class="inputWrap">
				<input type="text" v-model="username" placeholder="你的手机号/邮箱" autocomplete="off" />
			</div>
			<div class="text">
				<p class="tips">请输入注册时用的邮箱或者手机号呀</p>
			</div>
			<div class="inputWrap">
				<input type="password" v-model="psw" placeholder="密码"/>
			</div>
				<div class="text clearfix">
					<span class="forgot">忘记密码?</span>
				</div>
			<div class="text">
				<p class="tips">喵，你没输入密码么？</p>
			</div>
			<div class="btnBox">
				<span class="btn btnlogin" @click="sub">立即登录</span>
				<span class="btn">注册</span>
			</div>
		</div>
	</div>
</template>

<script>
	import axios from "axios"
	import CONFIG from "@/config";
	export default {
		data(){
			return {
				username:"",
				psw:""
			}
		},
		methods:{
			sub(){
				console.log(this)
				console.log(this.psw)
				axios.post(CONFIG.domain+"/login",{
						"username":this.username,
						"psw":this.psw
				})
				.then((res)=>{
					console.log(res)
					if(res.data.data=="0"){
						alert("账户或密码输入有误")
					}
					if(res.data.data=="1"){
						alert("验证成功")
						setTimeout(()=>{
							sessionStorage.setItem("isLogin",true)
//								路由的跳转
							this.$router.push("space")
						},1000)
					}
				})
				.catch((e)=>{
					console.log(e)
				})
				
			}
		}
	}
</script>

<style lang="scss" type="text/css">
.zhu{
	padding-top: 50px;
}
	body{
		background-color: #f5f5f5;
	}
	.clearfix:after{
		content: "";
		display: block;
		clear: both;
	}
	.form{
		padding: 15px;
		box-sizing: border-box;
	}
	.inputWrap{
		border-radius: 6px;
	    margin-bottom: 10px;
	    background: #fff;
	    width: 100%;
	    border: 1px solid #ddd;
	    height: 45px;
	    line-height: 45px;
	    overflow: hidden;
	    box-sizing: border-box;
	    position: relative;
		input{
			width: 100%;
			border: 0;
			outline: none;
		    border-radius: 6px;
    		padding: 10px;
		}
	}
	.tips{
		padding: 0 0 8px 2px;
    	color: #de698c;
	}
	.btn{
		display: block;
	    border: 1px solid #00a1d6;
	    text-align: center;
	    box-sizing: border-box;
	    width: 100%;
	    border-radius: 32px;
	    padding: 12px;
	    margin-bottom: 10px;
	    color: #00a1d6;
	    background: #fff;
	}
	
	.forgot{
		    float: right;
    		padding: 0 0 8px 2px;
    		color: #00a1d6;
	}
	.btnlogin{
	    background-color: #00a1d6;
    	color: #fff
	}
</style>